﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;

namespace KiraSh.ResumeTracker
{
    public partial class ucCompanySelect : UserControl
    {
        private XMLDealer xml = new XMLDealer();

        public ucCompanySelect()
        {
            InitializeComponent();
        }

        private void ucCompanySelect_Load(object sender, EventArgs e)
        {
            string companyFilePath = PathHelper.MapCombine(CurrentContext.Profile + ".xml");
            Company currentCompany = CurrentContext.Company;

            List<Company> companies = (List<Company>)xml.LoadXML(companyFilePath, typeof(List<Company>));
            if (companies != null)
            {
                foreach (Company company in companies)
                {
                    int i = bxCompany.Items.Add(company);
                    if (company.Equals(currentCompany))
                    {
                        bxCompany.SelectedIndex = i;
                    }
                }
            }
        }


    }
}
